import './assets/main.scss'

import { createApp } from 'vue'
import { createPinia } from 'pinia'
import { useAppStore } from '@/stores/app'

import App from './App.vue'
import router from './router'

import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// 自定义图标
import 'virtual:svg-icons-register'
import SvgIcon from './views/icons/SvgIcon.vue'

// 代码高亮器
import Shiki from '@/components/Shiki/index.vue'

const app = createApp(App)

app.use(createPinia())
app.use(router)
app.use(ElementPlus, { size: useAppStore().size })

// 全局组件
for (const [key, component] of Object.entries(ElementPlusIconsVue)) { // Element图标
  app.component(key, component)
}
app.component('SvgIcon', SvgIcon) // 自定义图标
app.component('Shiki', Shiki) // 代码高亮器

app.mount('#app')
